package cn.ichiva.dl.tushare.analy.ws;

import org.java_websocket.WebSocket;

import java.util.HashMap;

/**
 * session
 * 用于保存上下文信息
 */
public class WebsocketSession extends HashMap {

    private WebSocket webSocket;

    public WebSocket getWebSocket() {
        return webSocket;
    }

    public void setWebSocket(WebSocket webSocket) {
        this.webSocket = webSocket;
    }

    @Override
    public boolean equals(Object o) {
        if(o instanceof WebsocketSession){
            return ((WebsocketSession) o).getWebSocket().equals(this);
        }
        return false;
    }

    @Override
    public int hashCode() {
        return webSocket.hashCode() + 1;
    }
}
